﻿<shared:PageBase x:Class="Miris.HumanMilkAnalyser.WPF.DiagnosticMessageReferenceSetupPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:shared="clr-namespace:Miris.HumanMilkAnalyser.WPF.Shared"
      xmlns:validationRule="clr-namespace:Miris.HumanMilkAnalyser.WPF.ValidationRules"
      x:Name="CurrentPage"
      mc:Ignorable="d" 
      d:DesignHeight="580" d:DesignWidth="1160"
	  Title="DiagnosticMessageReferenceSetupPage" Style="{StaticResource DefaultPageStyle}" 
     Loaded="CurrentPage_Loaded"
      DataContext="{Binding DiagnosticMessageReferenceSetup, Source={StaticResource Locator}}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Skins/Storyboard/PageStoryborad.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Grid HorizontalAlignment="Center">
        <Grid.ColumnDefinitions>
            <!-- Back Button -->
            <ColumnDefinition Width="Auto" />
            <!-- Main Content -->
            <ColumnDefinition Width="Auto" />
            <!-- Next Button -->
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Button Margin="0,0,30,0" Width="47" Tag="/Skins/Resource/Image/Back.png" Style="{StaticResource OpacityImageButton}" Click="ButtonReturn_Click" />
        <!-- Trasparent effect Background -->
        <Border Grid.Column="1" Style="{StaticResource PageContentContainerBorder}">
            <Border Style="{StaticResource PageContentBackgroundBorder}" />
        </Border>
        <Grid Grid.Column="1" Width="1050" Height="550">
            <Grid.RowDefinitions>
                <!-- Page Title -->
                <RowDefinition Height="55" />
                <!-- Data Management Functions -->
                <RowDefinition />
                <RowDefinition Height="45" />
            </Grid.RowDefinitions>
            <TextBlock Text="指导意见配置" HorizontalAlignment="Center" Style="{StaticResource PageTitleTextBlock}" />
            <Grid Grid.Row="1" Margin="60,0,0,0" Height="500" HorizontalAlignment="Center">
                <Grid.ColumnDefinitions>
                    <!-- Message List -->
                    <ColumnDefinition />
                    <!-- Up, Down & Remove Button -->
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <DataGrid x:Name="DiagnosticMessageReferenceList" SelectedItem="{Binding SelectedMessageReference}" 
                              Style="{StaticResource EditableDataGrid}" Height="480">
                    <DataGrid.RowValidationRules>
                        <validationRule:DiagnosticMessageReferenceContentValidationRule ValidationStep="UpdatedValue" />
                    </DataGrid.RowValidationRules>
                    <DataGrid.Columns>
                        <DataGridTextColumn Width="*" Header="指导意见" Binding="{Binding MessageContent}" />
                    </DataGrid.Columns>
                </DataGrid>
                <Grid Grid.Column="1">
                    <Grid.RowDefinitions>
                        <!-- Up Button -->
                        <RowDefinition Height="Auto" />
                        <!-- Down Button -->
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Button ToolTip="上移" HorizontalAlignment="Left" Tag="/Skins/Resource/Image/Up.png" 
                                Command="{Binding MoveUpCommand}" CommandParameter="{Binding SelectedIndex, ElementName=DiagnosticMessageReferenceList}" 
                                Style="{StaticResource NavigationButton}" />
                    <Button Grid.Row="1" ToolTip="下移" HorizontalAlignment="Left" Tag="/Skins/Resource/Image/Down.png" 
                                Command="{Binding MoveDownCommand}" CommandParameter="{Binding SelectedIndex, ElementName=DiagnosticMessageReferenceList}" 
                                Style="{StaticResource NavigationButton}" />
                </Grid>
            </Grid>
            <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom">
                <Button Margin="0,0,10,0" Content="保存并返回" Style="{StaticResource RegularButton}" Command="{Binding SaveCommand}" />
                <Button Content="取消并返回" Style="{StaticResource RegularButton}" Click="ButtonCancel_Click" />
            </StackPanel>
        </Grid>
        <Button Grid.Column="2" Margin="30,0,0,0" Width="47" Tag="/Skins/Resource/Image/Next.png" Style="{StaticResource OpacityImageButton}" Visibility="Hidden" />
    </Grid>
</shared:PageBase>
